how to substitude in multiple lines between {{{ and }}} with sed or awk

Posted by chris on Super User See other posts from Super User or by chris
Published on 2012-05-30T11:57:03Z Indexed on 2012/05/31 4:43 UTC
Read the original article Hit count: 244

Filed under:
|
|
|

First give out the text example:

.... text ,..
{{{python
string1 = 'abcde'
string2 = '12345'
print(string1[[1:3]])
print(string2[[:-1]])
}}}
.... text ,..

the [[ and ]] happened outside of {{{ too.
And maybe there is spaces and tabs before {{{ and }}}.

I want to substitude all [[ and ]] into [ and ] between {{{ and }}}.

NOTICE: I need to write the result back to original file.

( Maybe sed or awk is not the only way to do this ? )

© Super User or respective owner

Related posts about regex

Related posts about sed